
#include <QPixmap>
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.
*****************************************************************************/


void UI_DlgInitial::init() {
    // Fill combobox with languages:
    QStringList languageList = PF_SYSTEM->getLanguageList();
    for (QStringList::Iterator it = languageList.begin();
    	it!=languageList.end();
        it++) {
            
        QString l = PF_SYSTEM->symbolToLanguage(*it);
        cbLanguage->insertItem(l);
        cbLanguageCmd->insertItem(l);
    }
        
        
        // units:
        for (int i=LX_Define::None; i<LX_Define::LastUnit; i++) {
        cbUnit->insertItem(PF_Units::unitToString((LX_Define::Unit)i));
    }
        
        cbUnit->setCurrentText("Millimeter");
        cbLanguage->setCurrentText("English");
        cbLanguageCmd->setCurrentText("English");
}

void UI_DlgInitial::setText(const QString& t) {
    lWelcome->setText(t);
}

void UI_DlgInitial::setPixmap(const QPixmap& p) {
    lImage->setPixmap(p);
}

void UI_DlgInitial::ok() {
    PF_SETTINGS->beginGroup("/Appearance");
    PF_SETTINGS->writeEntry("/Language", 
                            PF_SYSTEM->languageToSymbol(cbLanguage->currentText()));
    PF_SETTINGS->writeEntry("/LanguageCmd", 
                            PF_SYSTEM->languageToSymbol(cbLanguageCmd->currentText()));
    PF_SETTINGS->endGroup();
    
    PF_SETTINGS->beginGroup("/Defaults");
    PF_SETTINGS->writeEntry("/Unit", cbUnit->currentText());
    PF_SETTINGS->endGroup();
    accept();
}
